#ifndef xpack_docker_single_linked_node
#define xpack_docker_single_linked_node
#pragma push_macro("xuser")
#undef  xuser
#define xuser mixc::docker_single_linked_node::inc
#include"define/base_type.hpp"
#include"dumb/struct_type.hpp"
#include"macro/xexport.hpp"
#include"macro/xforward.hpp"
#include"macro/xmodify.hpp"
#include"macro/xstruct.hpp"
#include"memop/swap.hpp"
#pragma pop_macro("xuser")

namespace mixc::docker_single_linked_node::origin {
    template<class item_t>
    xstruct(
        xtmpl(single_linked_node, item_t),
        xpubb(inc::struct_type<item_t>),
        xpubf(next, single_linked_node<item_t> *)
    )
        using inc::struct_type<item_t>::operator=;

        template<class ... args_t>
        constexpr single_linked_node(args_t && ... list) :
            inc::struct_type<item_t>(xforward(list)...), next(nullptr){
        }
    $

    template<class item_t>
    xstruct(
        xtmpl(single_linked_node_ptr, item_t),
        xprif(m_top,       single_linked_node<item_t> *)
    )
    public:
        using node_t    = single_linked_node<item_t>;
        using nodep     = node_t *;
    public:
        constexpr single_linked_node_ptr() : 
            m_top(nullptr){
        }

        nodep top() const {
            return m_top;
        }

        nodep swap_top(nodep value) const {
            inc::swap<nodep>(xmodify(m_top), xmodify(value));
            return value;
        }
    $
}

#endif

xexport_space(mixc::docker_single_linked_node::origin)